﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System.Threading.Tasks;
using IOP.Orleans.Client;
using IOP.Orleans.Service.MessageHub;
using Orleans;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;

namespace SimplePublishClient
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var host = new HostBuilder()
            .ConfigureAppConfiguration((context, config) => config.AddJsonFile("appsettings.json", true))
            .CreateOrleansServicesClient("TestClient", (context, clientBuilder) =>
            {
                clientBuilder.AddMessageHubService();
                clientBuilder.ClientBuilder.ConfigureLogging((log) => log.SetMinimumLevel(LogLevel.Information).AddConsole());
                clientBuilder.Services.AddHostedService<PublishHostService>();
            });
            await host.RunConsoleAsync();
        }
    }
}
